#ifndef __PLAYER_H
#define __PLAYER_H

#include "direction.h"
#include "action.h"
#include "items.h"
#include "rect.h"

#define MAX_NAMELEN 20
#define SPRITE_W 16
#define SPRITE_SIZE SPRITE_W
#define SPRITE_H 24
#define PLAYER_HPINIT 100

/* contains known information about a player that should be visible in the lobby */
typedef struct {
	char nickname [MAX_NAMELEN]; /* FIXME! Players do not have nicknames; clients do! remove this field */
	int character; /* char index from the predefined array of selectable characters */
} Playerdata;

/* contains ingame information about a player and the character they control */
typedef struct {
	Playerdata data;
	
	struct {
		int level;
		int max_hp;
	} skill;
	
	struct {
		int z; // map layer. from 0 = ground level to maybe 10 = top floor
		int x, y; // in whole tile units ranging from 0/0 to MAP_SIZE-1/MAP_SIZE-1
		Direction dir; // face direction, used if not moving (move.dir == DIR_NONE)
	} pos;
	
	Action action;
	Action want_action;
	Inventory inv;
	int hp; // current hp
	coord_t checkpoint; // respawn location on death
	
	struct {
		int frame;
	} anim;
} Player;

extern void player_init (Player *p);
extern coord_t player_pxpos (Player *p);
extern void player_display (Player *p, int map_offsetx, int map_offsety);

#endif
